<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看全部部门</title>
    <link rel="stylesheet" href="css/element.css">
    <script src="js/bootstrap.min.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/element.js"></script>
    <script src="js/echarts.min.js"></script>
    <style>
        #box{
            margin-left: 15px;
        }

    </style>
</head>
<body>

<div id="box">
    <h1>全部部门</h1>
    <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
</div>

<script>
    new Vue({
        el:"#box",
        data:{
            data: [
                // 研发部
                    {
                        label: '研发部3个',
                        children: [
                            {
                                label: '小灰',
                            },
                            {
                                label: '小蓝',
                            },
                            {
                                label: '小红',
                            },
                        ]
                     },

                // 行政部
                    {
                        label: '行政部2个',
                        children: [
                            {
                                label: '小胡',
                            },
                            {
                                label: '小向',
                            }
                        ]
                    },

                // 总裁办公室
                    {
                        label: '总裁办公室1人',
                        children: [
                            {
                                label: '小程',
                            }
                        ]
                    },


            ],

            defaultProps: {
                children: 'children',
                label: 'label'
            }
        },
        methods:{
            handleNodeClick(data) {
                console.log(data);
            }
        }
    })
</script>
</body>
</html>